<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>获取这台机器上 id 所使用的 hostname</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="mongoid.construct.html">MongoId::__construct</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mongoid.getinc.html">MongoId::getInc</a></div>
 <div class="up"><a href="class.mongoid.html">MongoId</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="mongoid.gethostname" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">MongoId::getHostname</h1>
  <p class="verinfo">(PECL mongo &gt;= 1.0.8)</p><p class="refpurpose"><span class="refname">MongoId::getHostname</span> &mdash; <span class="dc-title">获取这台机器上 id 所使用的 hostname</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mongoid.gethostname-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">static</span> <span class="type">string</span> <span class="methodname"><strong>MongoId::getHostname</strong></span>
    ( <span class="methodparam">void</span>
   )</div>

  <p class="para rdfs-comment">
   返回的 hostname 用于 <a href="class.mongoid.html" class="classname">MongoId</a> 产生唯一 id。
   这和
   <span class="function"><a href="function.gethostname.html" class="function">gethostname()</a></span> 应该会返回同样的值。
  </p>
  <p class="para">
   它和以下函数是一样的：
  </p>
  <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #007700">public&nbsp;static&nbsp;function&nbsp;</span><span style="color: #0000BB">getHostname</span><span style="color: #007700">()&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</span><span style="color: #0000BB">gethostname</span><span style="color: #007700">();<br />}<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
  </div>

 </div>


 <div class="refsect1 parameters" id="refsect1-mongoid.gethostname-parameters">
  <h3 class="title">参数</h3>
  <p class="para">此函数没有参数。</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-mongoid.gethostname-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   返回 hostname。
  </p>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="mongoid.construct.html">MongoId::__construct</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mongoid.getinc.html">MongoId::getInc</a></div>
 <div class="up"><a href="class.mongoid.html">MongoId</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
